package com.whz.work;

import com.whz.work.ex02.Constants;
import com.whz.work.ex02.servlet.PrimitiveServlet;
import lombok.extern.slf4j.Slf4j;

import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;

/**
 * @ClassName MainTest
 * @Description TODO
 * @Author hong-zhi
 * @Date 2021/5/27 16:02
 * @Version 1.0
 */
@Slf4j
public class MainTest {
    public static void main(String[] args) throws InterruptedException, MalformedURLException, ClassNotFoundException, InstantiationException, IllegalAccessException {
//        ServerSocketDemo.server("localhost", 8888, 1);
//        Thread.sleep(50);
//        SocketDemo.client("localhost", 8888);
        /**
         * System.getProperty("user.dir")
         * 当前项目所在的文件夹路径
         * C:\Work\Code\tomcat-work
         */
//        String property = System.getProperty("user.dir");
//        log.info("property: {}", property);

//        URLClassLoader loader = new URLClassLoader(new URL[]{new URL("file", null, Constants.JAVA_PATH )});
//        Class<?> clazz = loader.loadClass("com.whz.work.ex02.servlet.PrimitiveServlet");
//        PrimitiveServlet primitiveServlet = (PrimitiveServlet) clazz.newInstance();
//        primitiveServlet.destroy();
//        String lineSeparator = System.getProperty("line.separator", "/n");
//        log.info("lineSeparator: {}", lineSeparator);

        System.out.println("本机的默认编码====="+System.getProperty("file.encoding"));

    }
}
